import config from './config';
export default (url, data = {}, method = 'GET') => {
    return new Promise((resolve, reject) => {
        wx.request({
            url: config.host + url,
            data,
            method,
            header:{
                cookie:wx.getStorageSync('cookie').toString()
            },
            success: (res) => {
                if (data.isLogin) {
                    // console.log(res);
                    wx.setStorageSync('cookie', res.cookies)
                }
                resolve(res.data)
            },
            failure: (err) => {
                reject(err)
            }
        })
    })
}